﻿using System;
using NUnit.Framework;
using Smartkernel;

namespace Smartkernel.NUnitTest.
{
    [Category("Core")]
    [TestFixture]
    public class SmartBase64Test
    {
        [Test]
        public void Test()
        {
            //【01】编码解码测试（涉及方法：Encode、Decode、IsBase64）
            string message = @"ABCDEFGHTJKAHSJKHSasd23465767324hjsadhasjdbbjahsdhjasd!@#$^%&*()_+_+_:<>?|\\?&asdasKD<sadsa奥斯丁环境阿瑟";
            Assert.AreEqual(SmartBase64.Encode(""), "");
            Assert.AreNotEqual(SmartBase64.Encode("    "), "");
            Assert.AreEqual(SmartBase64.Decode(""), "");
            Assert.AreEqual(SmartBase64.Decode("   "), "");
            Assert.AreEqual(SmartAction.IsInvokeFail(delegate { SmartBase64.Decode(message); }), true);
            Assert.AreEqual(SmartBase64.Decode(SmartBase64.Encode(message)), message);
            Assert.AreEqual(SmartBase64.IsBase64(message), false);
            Assert.AreEqual(SmartBase64.IsBase64(""), true);
            Assert.AreEqual(SmartBase64.IsBase64("  "), true);
            Assert.AreEqual(SmartBase64.IsBase64(SmartBase64.Encode(message)), true);
        }
    }
}
